package com.app.controller;


import com.app.common.ResponseResult;
import com.app.entity.Evaluation;
import com.app.service.EvaluationService;
import io.swagger.annotations.ApiImplicitParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yeyuan
 * @since 2021-12-28
 */
@RestController
@RequestMapping("/evaluation")
public class EvaluationController {
    @Autowired
    private EvaluationService evaluationService;

    @GetMapping("/getEvaList")
    public ResponseResult<List<Evaluation>> getEvaList(@RequestParam String cid){
        System.out.println("11111");
        Long aLong = Long.valueOf(cid);

        List<Evaluation> courses = evaluationService.getListByCid(aLong);
        return ResponseResult.success(courses);
    }

    @PostMapping("/addOne")
    public ResponseResult addOne(@RequestBody Evaluation evaluation){
        evaluationService.addEvaluation(evaluation);
        return ResponseResult.success("新增评课成功");

    }
}
